package com.gyg.enums;

/**
 * 文件类型枚举
 */
public enum FileTypeEnum {

    PICTURE(1, "图片"),
    DOCUMENT(2, "文档"),
    AUDIO(3, "音频"),
    VIDEO(4, "视频");

    private Integer code;
    private String desc;

    FileTypeEnum (Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static FileTypeEnum getInstance(Integer code) {
        for (FileTypeEnum item : FileTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
}
